import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:osg/controllers/http.dart';


class AnnouncementDetail extends StatefulWidget {
  @override
  State<AnnouncementDetail> createState() => _SettingPageState();
}

class _SettingPageState extends State<AnnouncementDetail> {

  

  RxMap detailData = {}.obs;
  final uuid = Get.parameters['uuid'];
  getDetail() {
    Get.find<HTTPS>().getData('/announcement/$uuid', {}).then((res) {
      detailData.value = res;
    });
  }

    @override
  void initState() {
    // TODO: implement initState
    super.initState();
     WidgetsBinding.instance.addPostFrameCallback((_) {
      getDetail();
    });
    print(uuid);
  }



  @override
  Widget build(BuildContext context) {

    return Scaffold(
        appBar: AppBar(backgroundColor: Color(0xffffffff), centerTitle: true),
        body: Padding(
          padding: EdgeInsets.symmetric(horizontal: 15),
          child: ListView(
            children: [
              Obx(()=>
              Text(
                '${detailData['title']}',
                style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
              )
              )
              ,
              SizedBox(height: 5,),
              Row(
                children: [
                  Obx(()=>
                  Text(
                    '${detailData['created_at']}',
                    style: TextStyle(fontSize: 12, color: Color(0XFF999999)),
                  )
                  )
                  ,
                  SizedBox(
                    width: 15,
                  ),
                  Container(
                    padding: EdgeInsets.symmetric(horizontal: 5, vertical: 2),
                    decoration: BoxDecoration(
                        border: Border.all(color: Color(0XFF0F172B)),
                        borderRadius: BorderRadius.circular(5)),
                    child: 
                    Obx(()=>

                    detailData['category']!=null?
                     Text(
                      '${detailData['category']['title']}',
                      style: TextStyle(fontSize: 12),
                    ):Text('')

                    )
                   ,
                  )
                ],
              ),
              SizedBox(
                height: 20,
              ),
              Obx(()=>
                Html(data:'${detailData['content']}')
              )
            ,
              Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [ 
                  Image.asset(
                'static/loggin.png',
                width: 100,
                fit: BoxFit.fitWidth,
              )

                ],
              )
             ,

                Align(
                  child: Text(
                '温馨提示',
                style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
              ),
                )
              ,
              SizedBox(
                height: 15,
              ),
              Text(
                '   公海集合是用区块链技术，对应特定的作品艺术品生成的唯一数字凭证，具备不可篡改、不可分割、不可复制、可追溯的特性，使其成为具有收藏价值和现实资产属性的数字资产，我们的愿景是构建一个充满创意、活力与共享的数字文化娱乐新世界。在这个世界里，科技与艺术完美融合，为用户带来前所未有的沉浸式体验,多元的文化在这里交流碰撞,激发出无限的创新灵感，我们致力于打造一系列引领潮流的数字文创产品，让传统文化与现代科技相得益彰，为用户呈现精彩纷呈的视听盛宴! ',
                style: TextStyle(fontSize: 14, color: Color(0XFF999999)),
              ),
              SizedBox(height: 10,),
               Text(
                '   为保证平台及用户的合法权益和财产安全。请广大用户以我们官方认证渠通发布的信息为准切勿轻信谣传非经官方认证的各类社群媒体、社交平台(包括但不限于QQ群、微信群、公众号、小红书抖音等)中冒充平台官方人员所发布的德息。且平台发行的数字藏品仅具备收藏、欣算价值，官方对藏品价格不构成任何指导意义。请谨慎购买，严防炒作!',
                style: TextStyle(fontSize: 14, color: Color(0XFF999999)),
              )
            ,SizedBox(height: 30,)
            ],
          ),
        ));
  }
}
